function check_code() {
    var param = {
        code: $("#code").val(),
        id:$("#codeId").val()
    };
    console.log(param);
    var url = "/storage/Client/checkClientCode";
    var success = function (ret) {
        if (ret === true) {
            $("#code").addClass('error');
            $("#code_error").text('编码已存在');
        } else {
            $("#code").removeClass('error');
            $("#code_error").text('');
        }
    };
    ajax('get', url, param, success);
}

$("#code").blur(function () {
    check_code();
});

function checkClient() {
    check_code();
    var code = $("#code_error").text();
    //var storage = $("#parent_id_error").text();
    if (code !== '' ) {
        console.log(false);
        return false;
    } else {
        console.log(true);
        return true;
    }
}